# Load required packages
library(sf)
library(foreign)
library(dplyr)

# Load world shapefile
World1 <- st_read("/Users/sungmhan/Desktop/Data/maps_R/WorldCountries.shp")

# Replace 'cap_longitude' and 'cap_latitude' with the actual column names if different

# Plot base map
plot(st_geometry(World1), col = "white", border = "black",
     axes = FALSE, xlab = "", ylab = "")

capital<-read.dta("/Users/sungmhan/Desktop/Tang_Yu_Han/maps1/capital_city.dta")

# Plot capital cities
bla <- rgb(1/255, 1/255, 139/255)  # Deep blue
points(capital$cap_longitude, capital$cap_latitude,
       pch = 20, col = bla, cex = 0.5)


# Load volcano data
volcano <- read.csv("/Users/sungmhan/Desktop/Tang_Yu_Han/maps1/Volcano.csv")
guac <- rgb(245/255, 10/255, 1/255, 0.3)  # Semi-transparent red
points(volcano$Longitude, volcano$Latitude,
       pch = 4, col = guac, cex = 0.3)

# Load storm data
storm <- read.dta("/Users/sungmhan/Desktop/Tang_Yu_Han/maps1/Storm_all_1900_64.dta")
points(storm$sto_lon, storm$sto_lat,
       pch = 4, col = guac, cex = 0.3)

# Load earthquake data
earth <- read.csv("/Users/sungmhan/Desktop/Tang_Yu_Han/maps1/earthquake.csv")
points(earth$Longitude, earth$Latitude,
       pch = 4, col = guac, cex = 0.3)

# Load SPI-related data
spi <- read.dta("/Users/sungmhan/Desktop/Tang_Yu_Han/maps1/Data_working_spi_up.dta")
points(spi$SPI_long, spi$SPI_lat,
       pch = 4, col = guac, cex = 0.3)